{extends file='layout/admin.html'}

{block name='title'}Set Email domain - Intel Sales Advisor{/block}

{block name='content'}

<h1>Set Email domain</h1>
<div class="clearfix sub_nav"><span class="btn fr"><a href="admin/company_manage.html">Cancel</a></span><span class="btn fr"><a href="#" class="delete">Delete</a></span><span class="btn fr"><a href="#" class="add_email">Add Email Domain</a></span></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="content_table">
	<thead>
		<tr style="height: 10px">
			<th class="left" style="width: 5%;">Select</th>
			<th style="border-left: 1px solid #CCC; width: 40%;">Email Domain</th>
			<th style="border-left: 1px solid #CCC; width: 10%;" class="right">Date Added</th>
		</tr>
	</thead>
	<tbody class="text_indent">
	  <form action="admin/company_manage/company_email/{$info.id}" method="post" accept-charset="utf-8">
		<tr id="add_email" style="display:none">
			<td class="tac"></td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial; ">
				<input type="text" class="input_text_sml w290" name="email" value="New Email Domain" /> <input type="submit" value="Add" class="mt5" />
			</td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial;text-align: center"></td>
		</tr>
		</form>
		{foreach $data as $val}
		<tr{if !($val@iteration % 2)} class="odd"{/if}>
			<td class="tac"><input type="radio" name="del_id" value="{$val.id}" /></td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial;">{$val.email}</td>
			<td style="border-right-style: none; border-right-width: initial; border-right-color: initial; text-align: center">{date('m/d/Y', $val.add_time)}</td>
		</tr>
		{/foreach}
	</tbody>
</table>
<div class="clearfix sub_nav">
	<span class="btn fr"><a href="admin/company_manage.html">Cancel</a></span><span class="btn fr"><a href="#" class="delete">Delete</a></span><span class="btn fr"><a href="#" class="add_email">Add Email Domain</a></span>
</div>
<script type="text/javascript" charset="utf-8">
$('.add_email').click(function(){
  $('#add_email').show();
  return false;
});
$('form').submit(function(){
  var email = $('input[name=email]');
  if (!email.val()) {
    show_msg('email is empty', function(){
      email.focus();
    });
    return false;
  }
  return true;
});

$('a.delete').click(function(){
  if (!$('input[name=del_id]:checked').size()) {
    show_msg('you must select a item');
    return false;
  }
  confirm('Are you sure to delete this?', function(){
    location.href = SITE_URL+'/admin/company_manage/delete_email/'+$('input[name=del_id]:checked').val();
  });

  return false;
});
</script>
{/block}
